Drop support for statically calling these methods#4680
Conversation
Calling non-static methods statically is deprecated as of PHP 7.0.0, and forbidden as of PHP 8.0.0, anyway.
|
The somewhat cleaner solution would be to mark these methods as static, and remove support for calling them non-statically. That would constitute a more serious BC break, though. |
|
@cmb69 I think marking them as |
|
@KalleZ, the only drawback I see with this solution, is that we told users to call them non-statically since PHP 7. Of course, still cleaner to have them as factory methods (maybe we also could simplify the code a bit). |
|
It would be possible to mark these as static, but still support instance calls in the implementation for BC purposes (possibly with a deprecation). While we don't allow this in userland, we can do it internally. And if it's with eventual migration in mind, maybe that's okay? |
|
@nikic sounds reasonable to me, to at least give userland a migration period and ease 8.0 adoption |
|
I had a closer look, and if we really want to switch to factory methods, we also should drop the ::close() method; otherwise you could close the reader without any chance to open it again, but still would have the then useless XMLReader instance. |
|
@cmb69 That makes good sense too, +1 from me on deprecating those if we go down this route and pointing users to use |
|
Superseded by PR #4816; closing. |
Calling non-static methods statically is deprecated as of PHP 7.0.0,
and forbidden as of PHP 8.0.0, anyway.